<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('username')->comment('昵称');
            $table->string('email')->unique()->comment('邮箱');
            $table->timestamp('email_verified_at')->nullable()->comment('邮箱验证');
            $table->string('password')->notNULL();
            $table->string('mobile',11)->notNULL()->comment('手机号码');
            $table->string('useropenid')->nullable()->comment('微信openid');
            $table->string('userrealname')->nullable()->comment('真实姓名');
            $table->integer('usergroup')->default('1')->comment('用户组');
            $table->enum('sex',[1,2,3])->notNULL()->default('3')->comment('性别');
            $table->integer('usercoin')->comment('积分');
            $table->integer('subject')->nullable()->comment('学习科目');
            $table->string('avatar')->comment('头像');
            $table->enum('status',[1,2])->notNULL()->default('1')->comment('状态');
            $table->rememberToken();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
